from dataclasses import dataclass
from typing import Self

from poker_bot.core.models.enums.withdraw import WithdrawStatus


@dataclass
class WithdrawEntity:
    user_id: int
    payment_address: str
    summ: float
    payment_method_id: int
    id: int | None = None
    status: WithdrawStatus | None = None

    @classmethod
    def create(
        cls, user_id: int, payment_address: str, summ: float, payment_method_id: int
    ) -> Self:
        account = cls(
            user_id=user_id,
            payment_address=payment_address,
            summ=summ,
            payment_method_id=payment_method_id,
        )
        return account

    def update_status(self, new_status: WithdrawStatus):
        self.status = new_status
